package com.cloud.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebResourceConfigurer extends WebMvcConfigurationSupport {
    @Autowired
    private SecurityCloudConfig securityCloudConfig;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(securityCloudConfig.getFilePath() + "**").addResourceLocations(
                "file:" + securityCloudConfig.getFileRoot() + securityCloudConfig.getFilePath());
        super.addResourceHandlers(registry);
    }
}

